<template>
  <!-- 上证、沪深、沪市300 -->
  <el-row class="clearfix">
    <el-col :span="5">
      <Navtab/>
    </el-col>
    <el-col :span="14">
      <HSIndex/>
    </el-col>
    <!-- <span>{{' 路由传参:'+indexCode}}</span>
    <span>{{' 全局变量:'+$store.state.indexCode}}</span> -->
    <!-- <Navtab/> -->

  </el-row>
</template>

<script>
import Navtab from "../../../components/fore/common/Navtab"
import HSIndex from "../../../components/fore/market/HSIndex"
export default {
  props:['indexCode'],
  data() {
    return {}
  },
  methods:{
  },
  watch:{
    // 监听路由个股指数路由地址的变化，一旦发生改变立即传入store
    indexCode:function(newVal,oldVal){
      // this.sCode=newVal
      // this.stockID
      // this.indexCode=newVal;
      // console.log(this.indexCode);
    this.$store.commit('setIndexCode',newVal)
    this.$store.dispatch('selectStock',newVal)
    }
  },
  created:function () {
    this.$store.commit('setIndexCode',this.indexCode)
  },
  components:{
    Navtab,
    HSIndex
  }
}
</script>

<style>
</style>
